/*
 * libbeluga
 *
 * libbeluga is the property of its developers.  See the COPYRIGHT file
 * for more details.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef BELUGA_ACCOUNT_H
#define BELUGA_ACCOUNT_H

#include "libbeluga.h"

struct _BelugaAccount {
  PurpleAccount *account;
  PurpleConnection *pc;
  
  // connection info
  GSList *conns; /**< A list of all active connections */
  GSList *dns_queries;
  GHashTable *hostname_ip_cache;
  GHashTable *cookie_table;
  gchar *_xsrf;

  // internals
  gchar *beluga_app;
  gchar *beluga_id;
  guint seedTimeout;

  // account data
  gchar *name;
  gchar *uid;
  gchar *error;
  GHashTable *pods;
  gchar *podImagesPath;
  gchar *storagePath;
};


BelugaAccount *
BelugaAccountNew();

void
BelugaAccountFree(BelugaAccount *account);

void
BelugaAccountFromHtml(BelugaAccount *account, 
		      const gchar *html);

gboolean
BelugaAccountHasPod(BelugaAccount *account, 
		    const gchar *id);

BelugaPod *
BelugaAccountGetPod(BelugaAccount *account, 
		    const gchar *id);

void
BelugaAccountAddPod(BelugaAccount *account,
		    BelugaPod *pod);

void
BelugaAccountGenerateStoragePath(BelugaAccount *account);

const gchar *
BelugaAccountHost(BelugaAccount *account);

int
BelugaAccountSeedFetchCount(BelugaAccount *account);

const gchar *
BelugaAccountLocationLinkText(BelugaAccount *account);

const gchar *
BelugaAccountPhotoLinkText(BelugaAccount *account);

gboolean
BelugaAccountCheckVersion(BelugaAccount *account);

gboolean
BelugaAccountDebug(BelugaAccount *account);

#endif /* BELUGA_ACCOUNT_H */
